'use strict';

const vm = new Vue({
  el: '#guide',
  data: {
    chName: '点击科室获取更多信息',
    chDescription: '',
    enDescription: '',
    chItemDesc: '',
    enItemDesc: '',
    bill: '',
    workers: [],
  },
  created() {
    this.onRoom('前台');
  },
  methods: {
    onRoom(roomName) {
      const that = this;
      $.ajax({
        url: '../room',
        type: 'POST',
        data: {
          chName: roomName,
        },
        success(data) {
          console.log(data);
          that.chName = data.data.chName;
          that.chDescription = data.data.chDescription;
          that.enDescription = data.data.enDescription;
          that.chItemDesc = data.data.chItemDesc;
          that.enItemDesc = data.data.enItemDesc;
          that.bill = data.data.bill;
          that.workers = data.data.workers;
          console.log(that.chName);
        },
        error(data) {
          console.log(data);
        },
      });
    },
  },
  created() {
    this.$on('room', function(roomName) {
      this.onRoom(roomName);
    });
  },
});
